
function useSum(sum) {
    // let res = 0;
    let func = (...args) => {
        // res += nums.reduce((a,b) => a+b);
        sum(...args);
        return func;
    }
    return func
}
let sum = useSum(() => {});
sum(1,2)(3)

// function sum(...numsA) {
    
//     return (...numsB) => {
//         return numsA.reduce((a,b) => a+b) + numsB.reduce((a,b) => a+b)
//     };
// }

console.log(sum(1, 2)(3))
console.log(sum(1, 2)(3))

/**
 * @param funcName user_list 
 * @return userList 
 */
const func = (funcName) => {
    let arr = funcName.split('_');
    if ( arr.length <= 1 ) {
        return funcName;
    } else {
        for(let i = 1, len = arr.length ; i<len ; ++i) {
            arr[i] = arr[i][0].toUpperCase() + arr[i].slice(1);
        }
        return arr.join('');
    }
}

const objFindFunc = (obj) => {
    const keys = Reflect.ownKeys(obj);

    keys.forEach(key => {
        if (typeof obj[key] === 'function') {
            let temp = obj[key]; 
            obj[key] = undefined;
            obj[func(key)] = temp;
        }
    })
}

console.log(func('user_list'));